home *** CD-ROM | disk | FTP | other *** search
Text File | 1999-03-04 | 2.8 KB | 73 lines | [TEXT/ToyS] |
- property kdtPeriod : 0 -- Puts a '.' in there - you can replace it with what you want
- property kdtYearLong : 1 -- 1904-2020
- property kdtYear : 2 -- 00-99
- property kdtMonth : 3 -- 01-12
- property kdtMonthVar : 4 -- 1-12
- property kdtDay : 5 -- 01-31
- property kdtDayVar : 6 -- 1-31
- property kdtHour : 7 -- 00-23
- property kdtHourVar : 8 -- 0-23, empty if first item and followed by colon
- property kdtMinute : 9 -- 00-59
- property kdtSecond : 10 -- 00-59
- property kdtTicks : 11 -- 00-59
- property kdtText : 12 -- Not supported (Next nibble is done in text mode (Sun-Sat or Jan-Dec))
- property kdtTextFull : 13 -- Not supported (Next nibble is done in full text mode (Sunday-Saturday or January-December))
- property kdtColon : 14 -- ':' delimeter
- property kdtSlash : 15 -- '/' delimeter
-
-
-
- on run
- -- Try for last Sunday of March, 1998
- display dialog "The date of the last Sunday in March, 1998 is: " & ¬
- (the clock using nth {-1, 1, 3, 98})
-
- -- Try for second Monday of September, 2000 (I turn 33 :)
- display dialog "The date of the second Monday in September, 2000 is: " & ¬
- (the clock using nth {2, 2, 9, 2000})
-
- -- Create "MM/DD/YY" - note the reverse order
- set myFormat to 0
- set myFormat to dtAddItem(myFormat, kdtYear)
- set myFormat to dtAddItem(myFormat, kdtSlash)
- set myFormat to dtAddItem(myFormat, kdtDay)
- set myFormat to dtAddItem(myFormat, kdtSlash)
- set myFormat to dtAddItem(myFormat, kdtMonth)
-
- display dialog "Created date: " & (the clock using format myFormat) & ¬
- return & return & "Using: " & myFormat ¬
- buttons {"OK"} default button 1
-
- -- Create "MM/DD HH:MM" - note the reverse order
- set myFormat to 0
- set myFormat to dtAddItem(myFormat, kdtSecond)
- set myFormat to dtAddItem(myFormat, kdtColon)
- set myFormat to dtAddItem(myFormat, kdtHour)
- set myFormat to dtAddItem(myFormat, kdtPeriod) -- creates ' ' since slash is used below
- set myFormat to dtAddItem(myFormat, kdtDay)
- set myFormat to dtAddItem(myFormat, kdtSlash)
- set myFormat to dtAddItem(myFormat, kdtMonth)
-
- display dialog "Created date: " & (the clock using format myFormat) & ¬
- return & return & "Using: " & myFormat ¬
- buttons {"OK"} default button 1
-
- -- Create "DD.MM HH:MM" - note the reverse order
- set myFormat to 0
- set myFormat to dtAddItem(myFormat, kdtSecond)
- set myFormat to dtAddItem(myFormat, kdtColon)
- set myFormat to dtAddItem(myFormat, kdtHour)
- set myFormat to dtAddItem(myFormat, kdtSlash) -- creates ' ' since period is used below
- set myFormat to dtAddItem(myFormat, kdtMonth)
- set myFormat to dtAddItem(myFormat, kdtPeriod)
- set myFormat to dtAddItem(myFormat, kdtDay)
-
- display dialog "Created date: " & (the clock using format myFormat) & ¬
- return & return & "Using: " & myFormat ¬
- buttons {"OK"} default button 1
- end run
-
-
- on dtAddItem(dateFormat, newAddition)
- return dateFormat * 16 + newAddition
- end dtAddItem